package com.api.shopapi.service.impl;

import com.alibaba.fastjson.JSONArray;
import com.api.shopapi.entity.EInspectRecord;
import com.api.shopapi.mapper.EInspectRecordMapper;
import com.api.shopapi.service.EInspectRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("EInspectRecordServiceImplOne")
public class EInspectRecordServiceImpl implements EInspectRecordService {

    @Autowired
    private EInspectRecordMapper eInspectRecordMapper;


    @Override
    public int insert(EInspectRecord eInspectRecord) {
        return eInspectRecordMapper.insert(eInspectRecord);
    }

    @Override
    public EInspectRecord getByEInspectRecordCode(String eInspectRecordCode) {
        return eInspectRecordMapper.getByEInspectRecordCode(eInspectRecordCode);
    }

    @Override
    public List<EInspectRecord> getListByElderlyCode(String elderlyCode) {
        return eInspectRecordMapper.getListByElderlyCode(elderlyCode);
    }

    @Override
    public PageInfo<EInspectRecord> getPageListByElderlyCode(String elderlyCode, int pageIndex, int pageSize) {
        PageHelper.startPage(pageIndex, pageSize);
        List<EInspectRecord> eInspectRecordList = eInspectRecordMapper.getListByElderlyCode(elderlyCode);
        PageInfo<EInspectRecord> pageInfo = new PageInfo<>(eInspectRecordList);
        return pageInfo;
    }
}
